package com.dawn.module.hospital.controller.app.chs;

import com.dawn.framework.apisign.core.annotation.Sign;
import com.dawn.framework.common.pojo.CommonResult;
import com.dawn.module.hospital.controller.app.chs.vo.ChsOauthUserReqVO;
import com.dawn.module.hospital.dal.dataobject.chs.config.ChsConfigDO;
import com.dawn.module.hospital.service.ChsChannelOauthService;
import com.dawn.module.hospital.service.chs.config.ChsConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;


/**
 * @description:
 * @author: cnsu-cmh
 * @time: 2024/8/8 12:47
 */
@Tag(name = "医保移动支付授权 APP - bh")
@RestController
@RequestMapping("/bh/chs/oauth")
@Validated
public class AppChsChannelOauthController {


    @Autowired
    private ChsChannelOauthService chsChannelOauthService;

    @Resource
    private ChsConfigService chsConfigService;

    @Sign
    @PostMapping(value = "/config")
    @Operation(summary = "获取医保配置")
    public CommonResult chsConfig(){
        ChsConfigDO chsConfig = chsConfigService.getChsConfig();
        return CommonResult.success(chsConfig);
    }

    @Sign
    @PostMapping(value = "/user")
    @Operation(summary = "获取医保用户信息")
    public CommonResult userQuery(@Valid @RequestBody ChsOauthUserReqVO reqVO){
        return chsChannelOauthService.userQuery(reqVO);
    }

}
